home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / windows5 / xwinc100.zip / CONTRIB-.00 / CONTRIB- / contrib / examples / PEX / hello_draw.c < prev    next >
C/C++ Source or Header  |  1991-02-16  |  2KB  |  72 lines

  1. /* $XConsortium: hello_draw.c,v 5.1 91/02/16 09:32:19 rws Exp $ */
  2.  
  3. /***********************************************************
  4. Copyright (c) 1991 by Sun Microsystems, Inc. and the X Consortium.
  5.  
  6.                         All Rights Reserved
  7.  
  8. Permission to use, copy, modify, and distribute this software and its 
  9. documentation for any purpose and without fee is hereby granted, 
  10. provided that the above copyright notice appear in all copies and that
  11. both that copyright notice and this permission notice appear in 
  12. supporting documentation, and that the names of Sun Microsystems,
  13. the X Consortium, and MIT not be used in advertising or publicity 
  14. pertaining to distribution of the software without specific, written 
  15. prior permission.  
  16.  
  17. SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 
  18. INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT 
  19. SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
  20. DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  21. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  22. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  23. SOFTWARE.
  24.  
  25. ******************************************************************/
  26. /* a simple program using an x_drawable type workstation */
  27.  
  28. #include "phigs/phigs.h"
  29. #include "X11/Xlib.h"
  30. #include "X11/Xatom.h"
  31.  
  32. main()
  33. {
  34.     Pconnid_x_drawable    connid;
  35.     Display            *display;
  36.     int            screen;
  37.     Ppoint            text_pt;
  38.  
  39.     popen_phigs( PDEF_ERR_FILE, PDEF_MEM_SIZE );
  40.  
  41.     connid.display = display = XOpenDisplay( NULL );
  42.     screen = DefaultScreen( display );
  43.     connid.drawable_id = 
  44.        XCreateSimpleWindow( display, 
  45.            RootWindow( display, screen ), 
  46.            0, 0, 600, 600, 4, 
  47.            WhitePixel( display, screen ), 
  48.            BlackPixel( display, screen ) );
  49.  
  50.     XChangeProperty( display, connid.drawable_id, XA_WM_NAME,
  51.         XA_STRING, 8, PropModeReplace, "PEX Example 2", 13 );
  52.  
  53.     XMapWindow( display, connid.drawable_id );
  54.  
  55.     popen_ws( 1, &connid, phigs_ws_type_x_drawable );
  56.  
  57.     popen_struct( 1 );
  58.         text_pt.x = 0.2;
  59.         text_pt.y = 0.5;
  60.         pset_char_ht( 0.05 );
  61.         ptext( &text_pt, "Hello World", 11); 
  62.     pclose_struct( );
  63.  
  64.     ppost_struct( 1, 1, 1.0 );
  65.  
  66.     printf("return...");
  67.     getchar();
  68.  
  69.     pclose_ws( 1 );
  70.     pclose_phigs( );
  71. }
  72.